<%@ taglib prefix="c" uri="/WEB-INF/tlds/hdiv-c.tld"%>
<%@ taglib prefix="form" uri="/WEB-INF/tlds/hdiv-spring-form-3_0_4.tld"%>
<%@ taglib prefix="spring" uri="/WEB-INF/tlds/hdiv-spring.tld" %>
<%@ taglib prefix="display" uri="http://displaytag.sf.net" %>
<c:url value="mostrarHWF2006.html" var="generarAbono"/>

<%--
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@ taglib uri="/WEB-INF/tlds/hdiv-c.tld" prefix="c"%>
--%>

<script type="text/javascript">    
    
          
    function show_loading_mostrar(){  
        var loadmostrar = document.getElementById('loading_mostrar');  
        loadmostrar.innerHTML = '<img src="imagenes/logoProcesandoDown.gif" width=' + xx_d + 'height=' + yy_d + 'alt="Procesando" />';  
        loadmostrar.style.display = 'block';      
        }  
        
    function show_loading_procdegene(){  
        var loadprocdegene = document.getElementById('loading_procdegene');  
        loadprocdegene.innerHTML = '<img src="imagenes/logoProcesandoRight.gif" width=' + xx_r + 'height=' + yy_r + 'alt="Procesando" />';  
        loadprocdegene.style.display = 'block';      
        } 
    
    function mostrarLista(){
        if(document.forms[0].fecha.value ==""){
            alert("Ingrese la Fecha");
            document.forms[0].fecha.focus();
            return false;
        }
        
        if(!checkDate(document.forms[0].fecha)) return false;        
        
        moveForward('mostrar3');         
        return true;
    }
    
    function mostrarArchivo(){
        if(document.forms[0].fecha.value ==""){
            alert("Ingrese la Fecha");
            document.forms[0].fecha.focus();
            return false;
        }        
        if(!checkDate(document.forms[0].fecha)) return false;        
        
            
        winwidth='500';
        winheight='250';    
        ventana = window.open('about:blank', 'windowArchivo', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width='+winwidth+',height='+winheight);              
        
        var accion = 'archivo';        
        var target = 'windowArchivo';        
            
        document.forms[0].target = target;
        document.forms[0].accion.value = accion;
        document.forms[0].submit();                
        //ventana.close();
        
        //moveForward('archivo');         
        return true;
    }    
    
    function cursor_wait() {
      document.body.style.cursor = 'wait';
    }
    
    function mostrar(){ 
        //activar el div procesando con javascript
        show_loading_mostrar();
        setTimeout('show_loading_mostrar();', 1000);
        cursor_wait() ;
        ////// 
       //moveForward('mostrar');
       document.forms[0].accion.value = "mostrar";
       document.forms[0].submit(); 
    }      
    
    function procesoGenerar(){      
       if (confirm("Se generara el proceso de abonos. Desea Continuar? ")){
           moveForward('procesoGenerar');
           //activar el div procesando con javascript
            show_loading_procdegene();
            setTimeout('show_loading_procdegene();', 1000);
            cursor_wait();
            //////
       }       
       
    }      
   
    function generados(){     
      moveForward('generados');      
    }     
    </script>

<style type="text/css">  
<!-- 
#loading_mostrar {display:none;}
-->  
<!-- 
#loading_procdegene {display:none;}
-->  
</style> 

<form:form modelAttribute="form" action="${generarAbono}">
<form:hidden path="accion"/>
<form:hidden path="control"/>

<!--Favoritos:-->
<input type="hidden" id="codOpci" value="${codOpci}"/>
<input type="hidden" id="desOpci" value="${desOpci}"/>


<table id="fullheighttable" width="775" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td align="left" valign="top" class="fondo_contenido padtop16left21">
      <table border="0" cellspacing="0" cellpadding="0" class="verdana11bazul">
      <tr>
        <td height="22" align="left" valign="top" class="verdana11bazul">
            <ul class="navlist2">
            <li><spring:message code="HMF2006.titulo"/></li>
            </ul>
        </td>
        </tr>
        <tr>
        <td>    
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#" id="opener_agregarFavoritos"> <img src="images/agregar_favoritos.png" width="25" height="23" border="0" title='Agregar Favoritos'/> </a>
        </td>
        </tr>
      <tr>
        <td align="left" valign="top" class="borde_totalblanco"><table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="105" height="23" align="left" valign="top" class="verdana10bazul">
            <spring:message code="HMF2006.cliente.titulo"/></td>
            <td height="23" align="left" valign="top" class="verdana10negro">
                <c:out value="${sessionScope.nombreCliente}"/></td>
          </tr>
        </table>
        </td>
      </tr>
      </table>

      <table>
      <tr>
      <td><input name="Submit2" type="button" class="boton" value="Mostrar" onclick="javascript:mostrar()"/></td>        
      <td><input name="Submit2" type="button" class="boton" value="Generados" onclick="javascript:generados()">
      </td>
      </tr>
      <tr>   </tr>
      <tr>   </tr>
      <tr>   </tr>
              <tr>
                <td colspan="2">  </td>
                    <td colspan="2" align="center">    
                        <div id="loading_mostrar"><img id="logoDown" src="imagenes/logoProcesandoDown.gif" alt="Procesando" /></div>  
                    </td>
                <td colspan="2">  </td>
               </tr> 
      </table>
          
      
      
      <table border="0" cellspacing="0" cellpadding="0" class="verdana13bgranate">
      <tr align="center">
          <td height="15">      
            <form:errors path="abono"/> 
          </td>
       </tr>
          <tr align="center">
          <td height="15"></td>
      </tr>      
      </table>          
    
 

      <c:if test="${not empty listadoAbonosPendientes}">      

      <table border="0" cellpadding="0" cellspacing="0" class="margintop20" >
        <tr >
          <td width="100%">
              <display:table id="listaPendiente" name="listadoAbonosPendientes" cellpadding="0"
                             cellspacing="0" style="width:100%" pagesize="10"
                             requestURI="${generarAbono}"
                             class="its">
               <tbody>
                <display:column property="tipo"
                                headerClass="even" class="even "
                                title="Tipo"/>
                <display:column property="fechaProcAper"
                                headerClass="even" class="cellderecha "
                                title="Fecha"/>
                <display:column property="cargoIngreso"
                                headerClass="even" class="cellderecha "
                                title="Cargo"/>
                <display:column property="tipoUnidad"
                                headerClass="even" class="even "
                                title="Unid"/>                
                <display:column property="cuenta"
                                headerClass="even" class="cellderecha "
                                title="Cuenta"/>
                <display:column property="codReferenciaBco"
                                headerClass="even" class="cellderecha "
                                title="Cod. Refer."/>
                <display:column property="numCS"
                                headerClass="even" class="cellderecha "
                                title="CS"/>
                <display:column property="numActa"
                                headerClass="even" class="cellderecha "
                                title="Acta"/>
                <display:column property="puntoOrigen"
                                headerClass="even" class="even "
                                title="Origen"/>
                <display:column property="monto"
                                headerClass="even" class="cellderecha "
                                title="Monto"/>
                <display:column property="anomalia"
                                headerClass="even" class="cellderecha "
                                title="Anomalia"/>
                <display:column property="neto"
                                headerClass="even" class="cellderecha "
                                title="Neto"/>
               </tbody>
              </display:table>
          </td>
        </tr>
        <tr><td>&nbsp;</td>
        </tr>
      </table>
      
      <!-- Total de los Abonos pendientes -->
      <table width="90%" class="verdana11bazul">
      <c:forEach items="${listaTotalPendientes}" varStatus="rowTot" var="totalPend" >          
          <tr>
            <td  height="23" align="left" valign="top">
            <%--<c:out value="${rowTot.count}"/> --%>
            <c:out value="${totalPend.descTipoUnidMonetaria}"/></td>
            <td height="23" align="left" valign="top">
                Monto:</td>
            <td  height="23" align="left" valign="top">
            <c:out value="${totalPend.montoTotal}"/></td>
            <c:if test="${sessionScope.cliente eq 1 or sessionScope.cliente eq 14}">
            <td  height="23" align="left" valign="top">
                Monto Neto:</td>
            <td  height="23" align="left" valign="top">
            <c:out value='${totalPend.montoNetoTotal}'/></td>
            <td  height="23" align="left" valign="top">
                CS sin recuento:</td>
            <td  height="23" align="left" valign="top">
            <c:out value='${totalPend.cantidadItems}'/></td>                
            </c:if>
          </tr>      
      </c:forEach>
      </table>
      
      <table>
      <tr>
      <td><input name="Submit2" type="button" class="boton" value="Proceso de Generaci&oacute;n" onclick="javascript:procesoGenerar()"></td>
      </tr>
      </table>    
          <table width="775" align="center">
              <tr>
                <td colspan="2" align="center">    
                <div id="loading_procdegene"><img id="logoRight" src="imagenes/logoProcesandoRight.gif" alt="Procesando" /></div>  
                </td>
              </tr>  
          </table>
    </c:if>      
          
    <c:if test="${not empty listadoAbonosError}">    
    
      <br>
          <table border="0" cellpadding="0" cellspacing="0" class="margintop20">
            <tr>
              <td height="22" align="left" valign="top"
                  class="verdana13bgranate">
                  <spring:message code="HMF2006.abonos.noIncluidos.titulo"/>
                  </td>
            </tr>
          </table>

     <table border="0" cellpadding="0" cellspacing="0" class="margintop20" >
        <tr >
          <td width="100%">
              <display:table id="listaError" name="listadoAbonosError" cellpadding="0"
                             cellspacing="0" style="width:100%" pagesize="10"
                             requestURI="${generarAbono}"
                             class="its">
               <tbody>
                <display:column property="tipo"
                                headerClass="even" class="even "
                                title="Tipo"/>
                <display:column property="fechaProcAper"
                                headerClass="even" class="cellderecha "
                                title="Fecha"/>
                <display:column property="tipoUnidad"
                                headerClass="even" class="even "
                                title="Unid"/>      
                <display:column property="numCS"
                                headerClass="even" class="cellderecha "
                                title="CS"/>                                
                <display:column property="cuenta"
                                headerClass="even" class="cellderecha "
                                title="Cuenta"/>
                <display:column headerClass="even" class="cellizquierda "
                                title="Descripcion / Accion">
                                 <c:forEach items="${listaError.listValidacion}" varStatus="rowVal" var="validacion" >   
                                    <div><c:out value="${rowVal.count}"/> - <c:out value='${validacion.descMensaje}'/> / <br> &nbsp;&nbsp;&nbsp;&nbsp; <c:out value='${validacion.accionMensaje}'/>
                                    </div>  
                                </c:forEach>                                 
                </display:column>                

                <display:column property="monto"
                                headerClass="even" class="cellderecha "
                                title="Monto"/>
               </tbody>
              </display:table>
          </td>
        </tr>
        <tr><td>&nbsp;</td>
        </tr>
      </table>      
      
     <!-- Total de los Abonos Error -->
      <table width="90%" class="verdana11bazul">
      <c:forEach items="${listaTotalError}" varStatus="rowTot" var="totalError" >          
          <tr>
            <td height="23" align="left" valign="top">
            <%--<c:out value="${rowTot.count}"/>--%>
            <c:out value="${totalError.descTipoUnidMonetaria}"/></td>
            <td height="23" align="left" valign="top">
                Monto:</td>            
            <td height="23" align="left" valign="top">
            <c:out value="${totalError.montoTotal}"/></td>
            <c:if test="${sessionScope.cliente eq 1 or sessionScope.cliente eq 14}">    
            <td height="23" align="left" valign="top">
                Monto Neto:</td>
            <td height="23" align="left" valign="top">
            <c:out value='${totalError.montoNetoTotal}'/></td>
            <td height="23" align="left" valign="top">
                CS sin recuento:</td>
            <td height="23" align="left" valign="top">
            <c:out value='${totalError.cantidadItems}'/></td>                
            </c:if>
          </tr>      
      </c:forEach>
      </table>      
      
          <table>
            <tr>
              <td height="22" align="left" valign="top" class="verdana11bazul">
                <spring:message code="HMF2006.abonos.totalGeneral.titulo"/>
              </td>
            </tr>
          </table>
          
<!-- Total General Procesado -->
          <table width="90%" class="verdana11bazul">
            <c:forEach items="${listaTotalProceso}" varStatus="rowTot"
                       var="totalProc">
              <tr>
                <td height="23" align="left" valign="top">
                  <%-- <c:out value="${rowTot.count}"/>--%>
                  <c:out value="${totalProc.descTipoUnidMonetaria}"/>
                </td>
                <td height="23" align="left" valign="top">Monto:</td>
                <td height="23" align="left" valign="top">
                  <c:out value="${totalProc.montoTotal}"/>
                </td>
                <c:if test="${sessionScope.cliente eq 1 or sessionScope.cliente eq 14}">    
                <td height="23" align="left" valign="top">Monto Neto:</td>
                <td height="23" align="left" valign="top">
                  <c:out value='${totalProc.montoNetoTotal}'/>
                </td>
                <td height="23" align="left" valign="top">CS sin recuento:</td>
                <td height="23" align="left" valign="top">
                  <c:out value='${totalProc.cantidadItems}'/>
                </td>
                </c:if>
              </tr>
            </c:forEach>
          </table>

      </c:if>      
     
    </td>
  </tr>
</table>
</form:form>